package fr.p10.miage.rps.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * User: naberrad
 * Date: 28/10/13
 * Time: 10:54
 * To change this template use File | Settings | File Templates.
 */
public class Player {

    private String nom;
    private int score;
    private List<RPSEnum> Listmouv;
    private static final int nbMouv = 10;
    private Iterator iter;

    public Player(String nom, List<RPSEnum> listmouv) {
        this.nom = nom;
        Listmouv = listmouv;
        score = 0;
        iter = Listmouv.iterator();
    }

    public Player(String nom) {
        this.nom = nom;
        Listmouv = new ArrayList<RPSEnum>();
        Random rand = new Random();
        int mouv;
        for (int i = 0; i < nbMouv; i++) {
            mouv = rand.nextInt(3);
            switch (mouv) {
                case 0:
                    Listmouv.add(RPSEnum.ROCK);
                    break;

                case 1:
                    Listmouv.add(RPSEnum.PAPER);
                    break;

                case 2:
                    Listmouv.add(RPSEnum.SCISSORS);
                    break;
            }
        }
        iter = Listmouv.iterator();
    }

    public String getNom() {
        return nom;
    }


    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public static int getNbMove() {
        return nbMouv;
    }

    public RPSEnum getNextMove() {
        return (RPSEnum)iter.next();
    }
}
